package main

import (
	"image/color"
	"time"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/canvas"
)

func main() {
	a := app.New()
	w := a.NewWindow("canvas")
	c := w.Canvas()

	blue:= color.NRGBA{R: 0, G: 0, B: 180, A: 255}
	r := canvas.NewRectangle(blue)
	c.SetContent(r)

	go func ()  {
		time.Sleep(time.Second*2)
		green:= color.NRGBA{R: 0, G: 180, B:0, A:255}
		r.FillColor = green
		
		r.Refresh()
	}()

	setContentText(c)
	
	w.Resize(fyne.NewSize(300,200))
	w.ShowAndRun()
}

func setContentText(c fyne.Canvas) {
	green:= color.NRGBA{R: 0, G: 0, B: 180, A: 255}
	text:= canvas.NewText("Text", green)
	text.TextStyle.Bold = true
	c.SetContent(text)
}